package com.example.demo_2301a.wed;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author LR
 * @version 1.0
 * @date 2025/2/26
 * @description TODO
 */
@Controller
public class reContro {
    @RequestMapping("list")
    @ResponseBody
    public String register(String name,String password)throws Exception {
        UserDao userDao = new UserDao();
        USer user = userDao.getUserByName(name);
        if(user==null){
            int i = userDao.addUser(name, password);
            if(i>0){
                return "成功";
            }else{
                return "失败";
            }
        }else{
            return "用户已存在";
        }
    }
}
